define(['backbone', 'underscore', 'jsonview', 'jquery'], function(Backbone, _, jsonview, $) {

  var log = console.log;
  
  function main() {
    require([], app);
  };

  function app() {
    var $app = $('<div id="app">')
    $('#main').html($app);

    var mapSQ = currying(map, square);

    log(mapSQ([1,2,3]))
  }

  function square(i) {
    return i * i;
  }

  function map(handler, list) {
    return list.map(handler);
  }

  function currying(fn) {
    var slice = Array.prototype.slice;
    var __args = slice.call(arguments, 1);

    return function() {
      var __inargs = slice.call(arguments);
      return fn.apply(null, __args.concat(__inargs));
    }
  }

  return main;
})


/**
 * fn¹ = currying(fn, a¹, a², a³...) => fn¹(b¹, b², b³...) = fn(a¹, a², a³..., b¹, b², b³...)
 */